package com.atguigu.day03;

public class Example11 {
    public static void main(String[] args) {
        add(1,2);
        add("hello", "world");
        add(1, "a");
        System.out.println(1 + 1.0);
    }

    public static void add(Object a, Object b) {
        if (a instanceof Integer && b instanceof Integer) {
            System.out.println((Integer) a + (Integer) b);
        } else if (a instanceof String && b instanceof String) {
            System.out.println(a.toString() + b.toString());
        } else {
            System.out.println("类型错误！");
        }
    }
}
